package com.TestDemo.Test1;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class TestArrayList {

    @Test
    public void Test(){
        Object[] objects = new Object[]{1,23,43,5};
        Object[] objects1 = new Object[]{5,8,"9632","awer"};



        ArrayList<Object[]> arrayList = new ArrayList<>();

        arrayList.add(objects);

        System.out.println("查看Object【】：");
        for (Object object : objects) {
            System.out.print(object+" ");
        }

        System.out.println();
        System.out.println("set - operation--");
        System.out.println(arrayList.set(0,objects1));
        System.out.println();

        System.out.println(arrayList.size());

        // 遍历输出arrayList中的Object[]数组中的值
        System.out.println("out:");
        for (Object[] objects2 : arrayList) {
            for (int i = 0; i < objects2.length; i++) {
                System.out.print(objects2[i] + " ");
            }

        }


        System.out.println();



    }


    @Test
    public void test2(){
        // Test capacity
        ArrayList arrayList1 = new ArrayList();
        System.out.println("Test capacity :");
        int count = 0;
        while(count<50){
            arrayList1.add("count"+count);
            count++;
            System.out.print(count + " ");
        }

        System.out.println();
        System.out.println("list------");
        List list = arrayList1.subList(0, 50);
        System.out.println(list.toString());
    }

}
